#for in循环，每行位数向下递增，每列位数向右递减
print(" ","for in循每行位数向下递增，每列位数向右递减环")
for j in range(1,10):
    for i in range(1,j+1):
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
    print("")

#for in循环每行位数向下递减，每列位数向右递减
print(" ","for in循环每行位数向下递减，每列位数向右递减")
for j in range(9,0,-1):
    for i in range (1,j+1):
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
    print("")

#for in循环每行位数向下递增，每列位数向右递增
print(" ","for in循环每行位数向下递增，每列位数向右递增")
for j in range(1,10):
    for i in range(9,j,-1):
        print("{:<6}".format(""),end=" ")
    for i in range(j,0,-1):
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
    print("")
    
#for in循环每行位数向下递减，每列位数向右递减
print(" ","for in循环每行位数向下递减，每列位数向右递增")
for j in range(9,0,-1):
    for i in range(9,j,-1):
        print("{:<6}".format(""),end=" ")
    for i in range(j,0,-1):
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
    print("")

#while循环每行位数向下递增，每列位数向右递减
print(" ","while循环每行位数向下递增，每列位数向右递减")
j=1
while j<=9:
    i=1
    while i<=j:
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
        i+=1
    print("")
    j+=1

#while循环每行位数向下递减，每列位数向右递减
print(" ","while循环每行位数向下递减，每列位数向右递减")
j=9
while j>=1:
    i=1
    while i<=j:
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
        i+=1
    print("")
    j-=1
#while循环每行位数向下递增，每列位数向右递增
print(" ","while循环每行位数向下递增，每列位数向右递增")
j=1
while j<=9:
    i=9
    while i>=1:
        while i>j:
            print("{:<6}".format(""),end=" ")
            i-=1
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
        i-=1
    print("")
    j+=1

#while循环每行位数向下递减，每列位数向右递增
print(" ","while循环每行位数向下递减，每列位数向右递增")
j=9
while j>=1:
    i=9
    while i>=1:
        while i>j:
            print("{:<6}".format(""),end=" ")
            i-=1
        print("{}*{}={:<2}".format(i,j,i*j),end=" ")
        i-=1
    print("")
    j-=1
